{% extends 'myadmin/base.html' %}
{% block content %}
    <section class="content-header">
        <h1>
            员工管理
            <small>订餐系统后台管理</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="{% url 'myadmin_index' %}"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li class="active">员工管理</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content container-fluid">

        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">
                        <h3 class="box-title">员工信息表</h3>

                        <div class="box-tools">
                            <form action="{% url 'myadmin_user_index' pIndex %}" method="get">
                                <div class="input-group input-group-sm" style="width: 150px;">
                                    <input type="text" name="keyword" class="form-control pull-right" placeholder="账号-昵称">

                                    <div class="input-group-btn">
                                        <button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body table-responsive no-padding">
                        <table class="table table-hover">
                            <tr>
                                <th>ID</th>
                                <th>员工账号</th>
                                <th>员工昵称</th>
                                <th>状态</th>
                                <th>创建时间</th>
                                <th>修改时间</th>
                                <th>操作</th>
                            </tr>
                            {% for item in userlist %}
                                <tr>
                                    <td>{{ item.id }}</td>
                                    <td>{{ item.username }}</td>
                                    <td>{{ item.nickname }}</td>
                                    {% if item.status == 6 %}
                                        <td style="color: blue">管理员</td>
                                    {% elif item.status == 1 %}
                                        <td style="color: green">正常</td>
                                    {% elif item.status == 2 %}
                                        <td style="color: red">禁用</td>
                                    {% elif item.status == 9 %}
                                        <td style="color: #440303">已删除</td>
                                    {% else %}
                                        <td style="color: red">未知状态</td>
                                    {% endif %}
                                    <td>{{ item.create_at|date:'Y-m-d H:i:s' }}</td>
                                    <td>{{ item.update_at|date:'Y-m-d H:i:s' }}</td>
                                    <td>
                                        <a type="button" class="btn btn-success btn-xs" href="{% url 'myadmin_user_edit' item.id %}">
                                            <span class="glyphicon glyphicon-edit" aria-hidden="true"></span> 编辑
                                        </a>
                                        <a type="button" class="btn btn-danger btn-xs" onclick="doDel('{% url 'myadmin_user_delete' item.id %}')">
                                            <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> 删除
                                        </a>
                                    </td>
                                </tr>
                            {% endfor %}


                        </table>
                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer clearfix">
                        <a role="button" href="{% url 'myadmin_user_add' %}" class="btn btn-primary">
                            <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> 添加员工</a>
                        <ul class="pagination pagination-sm no-margin pull-right">
                            <li><a href="{% url 'myadmin_user_index' pIndex|add:-1 %}?{{ mywhere|join:'&' }}">&laquo;</a></li>
                            {% for foo in plist %}
                                <li {% if foo == pIndex %}
                                    class="active"
                                {% endif %} >
                                    <a href="{% url 'myadmin_user_index' foo %}?{{ mywhere|join:'&' }}">{{ foo }}</a>
                                </li>
                            {% endfor %}
                            <li><a href="{% url 'myadmin_user_index' pIndex|add:1 %}?{{ mywhere|join:'&' }}">&raquo;</a></li>
                        </ul>
                    </div>
                </div>
                <!-- /.box -->
            </div>
        </div>

    </section>
{% endblock %}